package com.heima.crm.controller;

import com.heima.crm.common.result.Result;
import com.heima.crm.pojos.dtos.TransferDto;
import com.heima.crm.pojos.dtos.TransferPageDto;
import com.heima.crm.service.TransferService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 转派相关接口
 */
@Slf4j
@RestController
@RequestMapping("/transfer")
public class TransferController {
    @Autowired
    private TransferService transferService;

    /**
     * 转派分页查询
     *
     * @return
     */
    @GetMapping("/page")
    public Result page(TransferPageDto transferPageDto) {
        return transferService.page(transferPageDto);


    }

    /**
     * 详情回显
     *
     * @param id
     * @return
     */
    @GetMapping("/display/{id}")
    public Result display(@PathVariable Long id) {
        return transferService.display(id);


    }

    /**
     * 转派处理
     *
     * @param transferDto
     * @return
     */
    @PostMapping("/handle")
    public Result handle(@RequestBody TransferDto transferDto) {
        return transferService.handle(transferDto);
    }

}
